package cate.common.table.pay;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import easy.java.dev.note.NoteField;

public class PayItemRow extends ERow {

    @NoteField("名称")
    public String name;

    @NoteField("名称YID")
    public int nameYID;

    @NoteField(value = "名称(中文)", detail = "支付项原来的name会被动态替换为外文版，然后nameCn记录中文名")
    public String nameCn;

    @NoteField(value = "单价", detail = "单位：分")
    public int price;

    @NoteField("功能ID")
    public int funcId;

    @NoteField(value = "功能关联ID", detail = "原商品id（shopItemId）")
    public int funcSubId;

    @NoteField(value = "功能关联配置", detail = "字符串，可提供简单的扩展性，某些情况下可以省去额外建表")
    public String funcSubConf;

    @NoteField("vip积分")
    public long vipPoints;

    @NoteField("计费点")
    public String tradeCode;

    @NoteField("游戏外限购")
    public boolean outsideLimit;

    @NoteField("物品内容")
    public String itemString;

    @NoteField("特殊中文内容")
    public String specString;

    @Override
    public void parse(XSSFRowWrap xr) {
        this.id = xr.getInteger("ID");
        this.name = xr.getString("名称");
        this.nameYID = xr.getInteger("名称YID", -1);
        this.price = xr.getInteger("单价", 99999999);
        this.funcId = xr.getInteger("功能ID", -1);
        this.funcSubId = xr.getInteger("功能关联ID", 0);
        this.funcSubConf = xr.getString("功能关联配置");
        this.vipPoints = xr.getLong("vip积分", 0L);
        this.tradeCode = xr.getString("计费点");
        this.outsideLimit = xr.getBoolean("游戏外限购", false);
        this.itemString = xr.getString("物品内容");
        this.specString = xr.getString("特殊中文内容");
    }

    @Override
    public void decode() {
        // nothing to do
        this.nameCn = this.name;
//        if(null != this.getContext().getTranslator()) {
//            if(this.nameYID > 0) {
//                this.name = this.getContext().getTranslator().tt(this.nameYID, this.name);
//            }
//        }
    }

}
